﻿using System;
using System.Collections.Generic;
using System.Linq;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Flaws.Naming
{
  internal class NamingEventsShouldNotHaveBeforeOrAfterPrefix : FlawsIntrospectionRule
  {
    public NamingEventsShouldNotHaveBeforeOrAfterPrefix()
      : base("NamingEventsShouldNotHaveBeforeOrAfterPrefix")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from @event in Events
        where @event.Name.Name.StartsWith("Before", StringComparison.Ordinal) ||
              @event.Name.Name.StartsWith("After", StringComparison.Ordinal)
        select Result(@event);
    }
  }
}
